//
//  HttpRequest.m
//  p2p
//
//  Created by mokai on 14-8-13.
//  Copyright (c) 2014年 cloudyoo. All rights reserved.
//

#import "HttpRequest.h"

@implementation HttpRequest
@synthesize url;
@synthesize api;
@synthesize params;
@synthesize operator;
@synthesize  ok;
@synthesize no;
@synthesize httpCache;
@synthesize bodyBlock;
@synthesize uploadBlock;

-(void)request{
    [[HttpManager shareManager] request:self];
}

-(void)cancel{
    [operator cancel];
}

+(HttpRequest *)requestWithApi:(NSString *)api{
    return [self requestWithApi:api params:nil];
}

+(HttpRequest *)requestWithApi:(NSString *)api ok:(HttpOKBlock)ok no:(HttpNOBlock)no{
    return [self requestWithApi:api params:nil ok:ok no:no];
}

+(HttpRequest *)requestWithApi:(NSString *)api params:(NSDictionary *)params{
    return [self requestWithApi:api params:params ok:nil no:nil];
}

+(HttpRequest *)requestWithApi:(NSString *)api params:(NSDictionary *)params ok:(HttpOKBlock)ok no:(HttpNOBlock)no{
    HttpRequest *req = [[HttpRequest alloc] init];
    req.api = api;
    req.params = params;
    req.ok = ok;
    req.no = no;
    return req;
}
@end
